package com.springBoot.springBootSysCore.common.third.pay;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by timo on 2017/12/26.
 */
public class PayUtil {

    /**
     * 得到调用三方支付的参数
     * @param request
     * @param payWay		支付方式
     * @param number		订单号
     * @param money			支付金额
     * @param notify_url	回调地址
     * @return
     * @throws Exception
     */
    public static Object gainPayParams(HttpServletRequest request, String payWay, String number, String money, String notify_url) throws Exception{
        Object payParams = null;
        if("alipay".equals(payWay)){//支付宝支付
            payParams = AlipayUtil.alipayPay(number, "七色水滴:"+number, money, notify_url);
        }else if("wechat".equals(payWay)){//微信支付
            payParams = WechatUtil.wechatAppPay(request.getRemoteAddr(), number, "七色水滴:"+number, money,notify_url);
        }
        System.out.println("支付参数为:"+payParams);
        return payParams;
    }
}
